/*
 * Copyright 2008 The Native Client Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can
 * be found in the LICENSE file.
 */

#include <sys/socket.h>

#ifndef _NACL_SOCKET_H
#define _NACL_SOCKET_H

#define NACL_AF_INET  2
#define NACL_AF_INET6 10

#define NACL_SOCK_STREAM  1
#define NACL_SOCK_DGRAM   2


struct sockaddr;

struct nacl_abi_sockaddr {
  unsigned short int sa_family;
  char sa_data[14];
};

void __sockaddr_to_nacl_abi_sockaddr(const struct sockaddr*, socklen_t,
                                     struct nacl_abi_sockaddr*, size_t*);

void __nacl_abi_sockaddr_to_sockaddr(const struct nacl_abi_sockaddr*, size_t,
                                     struct sockaddr*, socklen_t*);

int __nacl_abi_protocl_to_protocol(int nacl_abi_protocol);
int __protocol_to_nacl_abi_protocol(int protocol);
int __nacl_abi_domain_to_domain(int nacl_abi_domain);
int __domain_to_nacl_abi_domain(int domain);


#endif